package com.example.hhhh;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

/**
 * @ProjectName: Hhhh
 * @Package: com.example.hhhh
 * @ClassName: CommonDialog1
 * @Description: java类作用描述
 * @Author: songhua
 * @CreateDate: 2020/1/9 0009 14:01
 */
public class CommonDialog1 extends Dialog {
    public CommonDialog1(Context context) {
        super(context, R.style.map_dialog);
        setOwnerActivity((Activity)context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.recharge_prompt);

        this.setCanceledOnTouchOutside(true);
        this.setCancelable(true);
        Window dialogWindow = getWindow();
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        //        p.height = (int) (d.getHeight() * 0.6); // 高度设置为屏幕的0.6
//        p.width = (int) (d.getWidth() * 0.65); // 宽度设置为屏幕的0.65
        lp.x = 0;
        lp.y = -20;

//        lp.width = mContext.getResources().getDisplayMetrics().widthPixels;
//        lp.height = mContext.getResources().getDisplayMetrics().heightPixels / 6 * 5;
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.MATCH_PARENT;
        lp.alpha = 9f; // 透明度
        dialogWindow.setAttributes(lp);


    }



    @Override
    public void show() {
        super.show();
    }

}
